package com.ccjq.jq173.member;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class TzServlet extends HttpServlet {
    private static final String FLAG_L="login";
    private static final String FLAG_R="regist";
    private static final String FLAG_Q="finduser";
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String flag=request.getParameter("flag");
        if (FLAG_L.equals(flag))
        {
            //登陆
            login(request,response);
        }
        else if(FLAG_R.equals(flag))
        {
            //添加
            regist(request,response);
        }
        else
        {
            //获取用户信息
            finduser(request,response);
        }

    }

    private void login(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        request.getRequestDispatcher("/WEB-INF/jsp/member/login.jsp").forward(request,response);
    }
    private void regist(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    {
        request.getRequestDispatcher("/WEB-INF/jsp/member/regist.jsp").forward(request,response);
    }
    private void finduser(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    {
        request.getRequestDispatcher("/WEB-INF/jsp/member/finduser.jsp").forward(request,response);
    }


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
